<?php

namespace App;

use Illuminate\Notifications\Notifiable;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
{
    use Notifiable;

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */

    protected  $guarded=["id"];

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
        'password', 'remember_token','openid'
    ];



    // 创建房源
    public function houses()
    {
        return $this->hasMany('App\House',"uid",'id');
    }

    // 关注房源
    public function liked_houses()
    {
        return $this->belongsToMany('App\House',"house_user","user_id","house_id");
    }


}
